package com.neouton.crm.sales.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.neouton.crm.entity.FileUploadRecordVO;
import com.neouton.crm.pm.entity.SalesProjectManageVO;
import com.neouton.crm.sales.entity.SalesFileRelationVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 巾凡
 * @description 针对表【file_relation(附件表)】的数据库操作Mapper
 * @createDate 2022-11-09 09:34:30
 * @Entity com.neouton.crm.sales.entity.SalesFileRelation
 */
@Mapper
public interface SalesFileRelationMapper extends BaseMapper<SalesFileRelationVO> {

    /**
     * 添加文件
     *
     * @param salesRelationId
     * @param fileIds
     * @param fileClass
     */
    void addFileRelation(@Param("salesRelationId") Integer salesRelationId, @Param("fileIds") List<FileUploadRecordVO> fileIds, @Param("fileClass") Integer fileClass);

    /**
     * 查询项目文件集合
     *
     * @param salesRelationId
     * @param fileClass
     * @return
     */
    List<SalesFileRelationVO> queryFileInfoList(@Param("salesRelationId") Integer salesRelationId, @Param("fileClass") Integer fileClass);

    SalesFileRelationVO queryFileById(String fileId);

    int deleteByPrimaryKey(Long id);

    int deleteByFileId(String fileId);

    int insert(SalesFileRelationVO record);

    int insertSelective(SalesFileRelationVO record);

    SalesFileRelationVO selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(SalesFileRelationVO record);

    int updateByPrimaryKey(SalesFileRelationVO record);

    int deleteFileLogic(SalesFileRelationVO file);

    int deleteFileInfo(String fileId,Integer fileClass);

    Boolean deleteFileBySalesFileId(String fileId);

    List<SalesFileRelationVO> queryFileByRelationIdAndFileClass(@Param("salesRelationId")Integer salesRelationId
                                                                ,@Param("fileClass")Integer fileClass);
}
